﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using Query2Object;

namespace Access
{
    class OleDbContext:IDbContext
    {
        private string connectionstring;

        #region IDbContext 成员

        public ISession GetSession()
        {
            ISession sa = new OleDbSession();
            sa.Context = this;
            sa.Init(connectionstring);
            SessionPool.Current.Push(Thread.CurrentThread.ManagedThreadId, sa);
            return sa;
        }

        public IStruts TableSchema()
        {
            return new OledbStruts(connectionstring);
        }

        public String ConnectionString
        {
            get
            {
                //throw new NotImplementedException();
                return connectionstring;
            }
            set
            {
                //throw new NotImplementedException();
                connectionstring = value;
            }
        }
        #endregion
    }
}
